home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / language / embedded / develop / libsrc11.arc / WRBLKSPI.C < prev    next >
C/C++ Source or Header  |  1989-04-27  |  1KB  |  38 lines

  1. /*    wrblkspi.c 4.2        */
  2. /*F****************************************************************************
  3.  
  4. FUNCTION NAME:    wrblkspi
  5.  
  6. ACTION:        Writes count characters to the SPI serial hardware from an
  7.         array of characters (short).
  8.  
  9. PARAMETERS:
  10.         array:    pointer to an array of bytes.
  11.  
  12.         count:    number of bytes to output to the SPI port.
  13.  
  14. RETURNS:    (void)
  15.  
  16. ******************************************************************************/
  17.  
  18. #include <hc11/directives.h>
  19.  
  20. SMALL
  21. void wrblkspi(array, count)
  22.  
  23.     unsigned short    *array;        /* pointer to data to be written */
  24.     int        count;        /* number of bytes to be written */
  25.  
  26.     {
  27.  
  28.     /****************************************************************/
  29.     /*    Note that "while ((count--) > 0)" is equivalent to    */
  30.     /*    "while ((--count) >= 0)" but the pre-decrement version    */
  31.     /*    is more efficient than the post-decrement version.    */
  32.     /****************************************************************/
  33.  
  34.     while ((--count) >= 0)
  35.         wrbytspi((unsigned) *(array++));
  36.  
  37.     }    /* end of wrblkspi    */
  38.